import request from '@/utils/request';
import {AxiosPromise} from 'axios';
import {WorkstationForm, WorkstationQuery, WorkstationVO} from '@/api/painting/workstation/types';

/**
 * 查询工位管理列表
 * @param query
 * @returns {*}
 */

export const listWorkstation = (query?: WorkstationQuery): AxiosPromise<WorkstationVO[]> => {
  return request({
    url: '/painting/workstation/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询工位管理详细
 * @param id
 */
export const getWorkstation = (id: string | number): AxiosPromise<WorkstationVO> => {
  return request({
    url: '/painting/workstation/' + id,
    method: 'get'
  });
};

/**
 * 新增工位管理
 * @param data
 */
export const addWorkstation = (data: WorkstationForm) => {
  return request({
    url: '/painting/workstation',
    method: 'post',
    data: data
  });
};

/**
 * 修改工位管理
 * @param data
 */
export const updateWorkstation = (data: WorkstationForm) => {
  return request({
    url: '/painting/workstation',
    method: 'put',
    data: data
  });
};

/**
 * 删除工位管理
 * @param id
 */
export const delWorkstation = (id: string | number | Array<string | number>) => {
  return request({
    url: '/painting/workstation/' + id,
    method: 'delete'
  });
};
